<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <button onclick="myFunc()">Click</button>
    <p id="result"></p>
    <script>
        function myFunc() {
            let fruits = ["苹果", "橘子", "葡萄", "草莓"];
            let txt = "";
            for (let i = 0; i < fruits.length; i++) {
                txt += "我喜欢吃" + fruits[i] + "<br>";
            }
            document.getElementById("result").innerHTML = txt;
        }
    </script>
</head>

<body>

</body>

</html>